<!--
 * @Author: your name
 * @Date: 2020-07-30 17:03:32
 * @LastEditTime: 2021-11-16 10:05:52
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \dashboard\src\views\component\particulars.vue
-->
<template>
  <div>
    {{ routerName }}
    <router-link
      v-if="$route.name === 'industrial-development-analysis'"
      particulars
      class="particulars"
      :to="{ name: 'labour-demand', query: { code: code, name: routerName } }"
      @click="goPage()"
    />
    <router-link v-else particulars class="particulars" :to="{ name: 'Fourstage', query: { code: code, name: routerName } }" @click="goPage()" />
  </div>
</template>

<script>
import mRouter from '@/router/modules/m-router'
import xRouter from '@/router/modules/x-router'
export default {
  name: 'Particulars',
  data() {
    return {
      code: ''
    }
  },
  computed: {
    routerPoor() {
      return [...mRouter, ...xRouter]
    },
    routerName() {
      return this.$route.matched[0].name + ',' + this.$route.matched[1].name
    }
  },
  created() {
    if (this.$route.name === 'population') {
      this.code = '000101'
    }
    if (this.$route.name === 'ground') {
      this.code = '000102'
    }
    if (this.$route.name === 'science-technology') {
      this.code = '000103'
    }
    if (this.$route.name === 'organization') {
      this.code = '000104'
    }
    if (this.$route.name === 'agricultural') {
      this.code = '000105'
    }
    if (this.$route.name === 'agricultural-production') {
      this.code = '000201'
    }
    if (this.$route.name === 'industrial-economy') {
      this.code = '000202'
    }
    if (this.$route.name === 'agricultural-market') {
      this.code = '000203'
    }
    if (this.$route.name === 'agricultural-technology') {
      this.code = '000204'
    }
    if (this.$route.name === 'productivity-level') {
      this.code = '000301'
    }
    if (this.$route.name === 'industrial-development') {
      this.code = '000302'
    }
  },
  methods: {
    goPage() {
      let name = 'Fourstage'
      if (this.routerName === 'industrial-development-analysis') {
        name = 'labour-demand'
      }
      this.$router.push({
        name: name,
        query: {
          code: this.code,
          name: this.routerName
        }
      })
    }
  }
}
</script>
<style scoped>
.particulars {
  width: 28px;
  height: 28px;
  position: fixed;
  right: 27px;
  top: 8%;
  z-index: 999;
  background-size: 100% 100% !important;
  background: url(~@/assets/img/sijiicon.png) no-repeat;
}
</style>
